package cn.cena;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
public class OrderServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderServerApplication.class);
    }

    // 配置一个RestTmplate
    @Bean
    @LoadBalanced // 负载均衡注解，让RestTemplate有负载均衡的能力，可以走注册中心做服务发现
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
